package com.tieto.springboot.demo.springbootweb;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.tieto.springboot.demo.springbootweb.bean.Student;
import com.tieto.springboot.demo.springbootweb.bean.User;

@RestController
public class HelloWorldController {

	@RequestMapping("/user/{id}")
	public User getUser(@PathVariable("id") String pId) {
		User user = new User();
		user.setId(pId);
		user.setUserName("tonylovexl");
		user.setPassword("tpy1209q");
		user.setSex("Male");
		user.setAge(30);
		return user;
	}

	@RequestMapping("/student/{id}")
	public Student getStudent(@PathVariable("id") String pId) {
		Student st = new Student();
		st.setId(pId);
		st.setUserName("tonylovexl");
		st.setPassword("tpy1209q");
		st.setSex("Male");
		st.setAge(30);
		st.setClassNum("初三四班");
		return st;
	}
}
